home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Visual Basic Toolbox
/
Visual Basic Toolbox (P.I.E.)(1996).ISO
/
buttons
/
multipic
/
multipic.txt
< prev
next >
Wrap
Text File
|
1992-01-19
|
2KB
|
47 lines
1/19/92 - Mark Gamber
MULTIPIC is an example of how to apply a number of bitmaps or icons to what
appears to be a single picture button. As is evidenced by looking at the form,
there are several buttons but only 3 different "types", each type consisting of
a general theme. For example, there is an "Exit" button, a down arrow and a
mouse. The "Exit" and Down Arrow buttons only go up or down. Therefore, three
buttons are required to implement the effect. To create the "Exit" button,
make one picture button and, using Copy and Paste, make two more of the same
button. ALWAYS COPY FROM THE ORIGINAL BUTTON, NOT FROM A COPY! Next, set the
BorderStyle to None and set the pictures. Use a default picture, in the case
of "Exit" it is the "up" position bitmap of the button, and apply it to the
original copy of the button. Now apply the "up" again to a copy and the "down"
to another copy. Set the copies Visible to FALSE.
In this case, the "down" bitmaps are in array number two, so when the mouse
is pressed, apply array two to array zero like so:
Picture1(0).Picture = Picture1(2).Picture
When the mouse is released, put back the original bitmap thus:
Picture1(0).Picture = Picture1(1).Picture
And you get a "pressed" 3-D effect. The "Down arrow" works the same way.
The mouse button has an extra picture since you can press the left or right
mouse button. The extra, of course, is the right button down. So, when a button
is pressed, your code might look like this:
if Button = 1 ' Left button
Picture3(0).Picture = Picture3(2).Picture
else
Picture3(0).Picture = Picture3(3).Picture
end if
When the button is released, do the same thing as the "Exit" button:
Picture3(0).Picture = Picture3(1).Picture
The advantage here is that you don't need to load the bitmaps and icons from
disk. Since they are already attached to a button, they are part of the program
itself.